@model NITASA.Helpers.Pager

@if (Model.PageCount > 1)
{
    using (Html.BeginForm(Model.Action, Model.Controller, FormMethod.Post, new { id = "frm1" }))
    {
        @Html.Hidden("PageCount", Model.PageCount)
        @Html.Hidden("PageSize", Model.PageSize)
        @Html.Hidden("CurrentPageIndex", Model.CurrentPageIndex)
        @Html.Hidden("SearchText", Model.SearchText)
    }
    <style>
        .page-navi ul li {
            background: #eee none repeat scroll 0 0;
            border: 1px double Black;
            float: left;
            margin: 4px;
            padding: 5px;
        }
            .page-navi ul li a {text-decoration:none;}
             .page-navi ul li.current a {
                color: green;
            }
    </style>
    <div class="page-navi">
        <ul>
            @for (var i = 0; i < Model.PageCount; i++)
            {
                if (i == Model.CurrentPageIndex)
                {
                    <li class="current"><a href="">@(i + 1)</a></li>
                }
                else
                {
                    <li><a href="" class="pager" pageindex="@i">@(i + 1)</a></li>
                }
            }
        </ul>
    </div>
    <script>
        $(document).ready(function () {
            $(".pager").click(function (evt) {
                evt.preventDefault();
                var pageindex = $(this).attr("pageindex");
                $("#CurrentPageIndex").val(pageindex);
                $('#frm1').submit();
            });
        });
    </script>
}